Gatsby Default StarterGatsby logo

#Network

on the [[Switch]] CLI - Command line userinterface

en : enable configure terminal if : interface fa: fast internet interface fa0/1 interface fa0/2

exit to go one level up

sh +tab : show

![[Pasted image 20240304110031.png]]

we see what we do on GUI on the command line interface as well;

![[Capture d’écran 2024-03-04 110526.png]]

1- Configuring the [[VLAN]]

go to the CLI on the switch

en (to enable) configure terminal vlan 10 name IT vlan 20 name HR

2 VLAN exists now.

![[Pasted image 20240304113923.png]]

to verify: ![[Pasted image 20240304113936.png]]

2- Configuring the [[Switch]] for VLAN

on the switch CLI

config terminal interface fa0/2 switchport mode access switchport access vlan 10 ... (we do it for each connection) interface fa0/5 (because it was the connection btw the router and the switch) switchport mode trunk (for the connection between the router and the switch)

3- Configuring the Router

on the router CLI

no en configure terminal interface fa0/0 no shutdown (to launch the interface) interface fa0/0.10 (10 for VLAN 10) encapsulation dot1Q 10 (10 for VLAN 10) - (this is required by CISCO) ip add 192.168.1.1 255.255.255.0 (first number to be on the same gateway) interface fa0/0.20 encapsulation dot1Q 20 ip add 192.168.2.1 255.255.255.0

for the second subnetwork we go to interface fa0/1 instead of interface fa0/0

so when we say ip add in the CLI it's to add a new IP address to the gateway address (to VLAN)

Deleting IP address errors no ip add 192.168.1.1 255.255.255.0 if I make an error

!!! show running-config to see the situation of the network !!!

we have put default gateway 192.168.1.1 for the VLAN 10 we have put default gateway 192.168.2.1 for the VLAN 20

![[Pasted image 20240304120051.png]]

![[Pasted image 20240304121028.png]]

Adding devices to a certain VLAN (10 or 20 here)

![[Pasted image 20240304133713.png]]

for the second router :

interface fa0/1

and when configuring the router CLI, we need to put interface fa0/1.30 or fa0/1.40 for the second switches connections

MY error was putting fa0/0.30

ping from computer CMD to check the connection from a pc to another pc

THE Schema used for the codes above

![[Pasted image 20240304150622.png]]

4- Adding a hub to the network

We delete the cables connecting the switches to the routes and connect them to a hub.

We connect the hub to the router directly.

In the router CLI; 1- We delete the 192.168.3.1 and 192.168.4.1 with no interface 192.168.3.1 2- We add interface fa0/0.30 to the router and add the ip addresses to the interface with the steps in 3rd section.

![[Pasted image 20240304163455.png]]

final architecture;

![[Pasted image 20240304163001.png]]

5- DHCP Configuration

cisco packet tracker, to do on the router that will distribute the ip adresses - on the Router CLI

Router(config)# ip dhcp pool CLIENT_LAN (put any name u want) Router(dhcp-config)# network 192.168.0.1 255.255.255.0 (put any value u want) Router(dhcp-config)# default-router 192.168.0.254 (put any value u want) Router(dhcp-config)# dns-server 1.1.1.1 (this step is not needed but good to know. we didn't use it this time) Router(dhcp-config)# exit

Router(config)# ip dhcp excluded-address 192.168.0.254 (excluding router's own adress so it doesn't distribute it and doesn't cause any conflicts / can do the same for host/broadcast adress)

Router(config)# interface fa0/1 Router(config-if)# ip add 192.168.0.254 255.255.255.0

Values might change depending from setup to setup. Now, go to the machines which the dhcp are distributed to, Dekstop tab, Ip config, and turn on the DHCP on ipv4 and it sould distribute the allowed ip adresses

6- DNS configuration

on router CLI

R1#configure terminal
R1(config)#ip dns server
R1(config)#ip domain-lookup

R1(config)#ip name-server 4.4.4.4 R1(config)#ip name-server 5.5.5.5

R1(config)#ip host PC1 192.168.13.1 R1(config)#ip host PC2 192.168.13.2 (check the ip address distributed to the devices)

if ping PC1 works on the Cisco Packet Tracer, it means that it works.

only ip dns server name-server x.x.x.x and and giving host ip to the machines is needed

Connecting 2 routers

R1 <-----> middle server <-----> R2

first network address is : 192.168.13.0 second network address is : 192.168.12.0

give an address between the routers R1 is 10.0.0.1 R2 is 10.0.0.2

on the R1 cli ip route 192.168.12.0 255.255.255.0 10.0.0.2

on the R2 cli ip route 192.168.13.0 255.255.255.0 10.0.0.1

![[Pasted image 20240311164705.png]]